﻿using ShardingCore.Core.EntityMetadatas;
using ShardingCore.Core.VirtualRoutes;
using ShardingCore.VirtualRoutes.Mods;
using ShardingCore.VirtualRoutes.Months;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;

namespace ShardingWTM.Models
{
    public class MessageLog:BasePoco
    {
        public string Payload { get; set; }
    }

    public class MessageLogRoute : AbstractSimpleShardingMonthKeyDateTimeVirtualTableRoute<MessageLog>
    {
        /// <summary>
        /// 配置分片字段
        /// </summary>
        /// <param name="builder"></param>
        public override void Configure(EntityMetadataTableBuilder<MessageLog> builder)
        {
            builder.ShardingProperty(o => o.CreateTime);
        }
  
        public override bool AutoCreateTableByTime()
        {
            return true;
        } 
        
        public override DateTime GetBeginTime()
        {
            return new DateTime(2022, 5, 1);
        }
    }
}
